cmake_minimum_required(VERSION 3.8)
project(zc4_servo)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)

# 本包用到的所有依赖包，集中写在这里
set(THIS_PACKAGE_DEPENDENCIES
  rclcpp
  geometry_msgs
  control_msgs
  moveit_msgs
  moveit_servo
  tf2_ros
  moveit_core
  moveit_ros_planning
)

# 逐个 find_package
foreach(DEP ${THIS_PACKAGE_DEPENDENCIES})
  find_package(${DEP} REQUIRED)
endforeach()

# 键盘输入节点
add_executable(zc4_keyboard_input_node src/zc4_keyboard_input.cpp)
target_include_directories(zc4_keyboard_input_node PUBLIC include)
ament_target_dependencies(zc4_keyboard_input_node ${THIS_PACKAGE_DEPENDENCIES})

# 力控伺服节点
add_executable(force_control2 src/force_control2.cpp)
target_include_directories(force_control2 PUBLIC include)
ament_target_dependencies(force_control2 ${THIS_PACKAGE_DEPENDENCIES})

install(
  TARGETS
    zc4_keyboard_input_node
    force_control2
  DESTINATION
    lib/${PROJECT_NAME}
)

ament_package()
